package cn.ltgodm.template.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ltgodm.template.user.domain.entity.UserRole;
import cn.ltgodm.template.user.service.UserRoleService;
import cn.ltgodm.template.user.mapper.UserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author wenpeng
* @description 针对表【lt_user_role(用户和角色关联表)】的数据库操作Service实现
* @createDate 2024-03-17 22:12:11
*/
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService{
    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public int deleteUserRoleByUserId(Long userId) {
        return userRoleMapper.delete(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, userId));
    }

    @Override
    public void deleteUserRole(Long[] userIds) {
        userRoleMapper.delete(new LambdaQueryWrapper<UserRole>().in(UserRole::getUserId, userIds));
    }
}




